home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / include / sys / audioreg.h < prev    next >
C/C++ Source or Header  |  1990-04-12  |  5KB  |  156 lines

  1. /*    "@(#)audioreg.h 1.11 89/04/11 SMI"
  2. */
  3.  
  4. /*    These defines facilitate access to the indirect registers.  One
  5.     of these values is written to the command register, then the
  6.     appropriate number of bytes are written/read to/from the data
  7.     register.
  8.  
  9.     The indirection values are formed by od'ing together two quantities.
  10.     The first three bits of the indirection value specifies the
  11.     chip subsystem (audio processor, multiplexor, etc.) to be accessed.
  12.     AMP calles these three bits the DCF, or destination code field.
  13.     The last five bits specify the register within the subsystem.  AMD
  14.     calls these bits the OCF, or Operation Code Field.
  15.  
  16.     Note that the INIT_INIT value differs from the data sheet.  The
  17.     data sheet is wrong -- this is right.
  18. */
  19.  
  20. #define AUDIO_PACK(reg,length)    (((reg) << 8) | (length))
  21. #define AUDIO_UNPACK_REG(x)    (((x) >> 8) & 0xff)
  22. #define AUDIO_UNPACK_LENGTH(x)    ((x) & 0xff)
  23.  
  24. #define AUDIO_INIT    0x20
  25. #define AUDIO_INIT_INIT    AUDIO_PACK((AUDIO_INIT | 0x01),1)
  26.  
  27. #define AUDIO_MUX    0x40
  28. #define AUDIO_MUX_MCR1    AUDIO_PACK(AUDIO_MUX | 0x01,1)
  29. #define AUDIO_MUX_MCR2    AUDIO_PACK(AUDIO_MUX | 0x02,1)
  30. #define AUDIO_MUX_MCR3    AUDIO_PACK(AUDIO_MUX | 0x03,1)
  31. #define AUDIO_MUX_MCR4    AUDIO_PACK(AUDIO_MUX | 0x04,1)
  32.  
  33. #define AUDIO_MAP    0x60
  34. #define AUDIO_MAP_X    AUDIO_PACK(AUDIO_MAP | 0x01,16)
  35. #define AUDIO_MAP_R    AUDIO_PACK(AUDIO_MAP | 0x02,16)
  36. #define AUDIO_MAP_GX    AUDIO_PACK(AUDIO_MAP | 0x03,2)
  37. #define AUDIO_MAP_GR    AUDIO_PACK(AUDIO_MAP | 0x04,2)
  38. #define AUDIO_MAP_GER    AUDIO_PACK(AUDIO_MAP | 0x05,2)
  39. #define AUDIO_MAP_STG    AUDIO_PACK(AUDIO_MAP | 0x06,2)
  40. #define AUDIO_MAP_FTGR    AUDIO_PACK(AUDIO_MAP | 0x07,2)
  41. #define AUDIO_MAP_ATGR    AUDIO_PACK(AUDIO_MAP | 0x08,2)
  42. #define AUDIO_MAP_MMR1    AUDIO_PACK(AUDIO_MAP | 0x09,1)
  43. #define AUDIO_MAP_MMR2    AUDIO_PACK(AUDIO_MAP | 0x0a,1)
  44. #define AUDIO_MAP_ALL    AUDIO_PACK(AUDIO_MAP | 0x0b,46)
  45.  
  46. /*  These are minimum and maximum values for various registers, in
  47.  *  normal units, *not* as written to the register.  Most are in db,
  48.  *  but the FTGR is in Hz.  The FTGR values are derived from the
  49.  *  smallest and largest representable frequency and do not necessarily
  50.  *  reflect the true capabilities of the chip.
  51.  */
  52. #define AUDIO_MAP_GX_MIN    0
  53. #define AUDIO_MAP_GX_MAX    12
  54. #define AUDIO_MAP_GR_MIN    -12
  55. #define AUDIO_MAP_GR_MAX    0
  56. #define AUDIO_MAP_GER_MIN    -10
  57. #define AUDIO_MAP_GER_MAX    18
  58. #define AUDIO_MAP_STG_MIN    -18
  59. #define AUDIO_MAP_STG_MAX    0
  60. #define AUDIO_MAP_FTGR_MIN    16
  61. #define AUDIO_MAP_FTGR_MAX    3999
  62. #define AUDIO_MAP_ATGR_MIN    -18
  63. #define AUDIO_MAP_ATGR_MAX    0
  64.  
  65. /*    These are the bit assignment in the INIT register.
  66.  
  67.     There are several ways to specify dividing the clock by 2.  Since
  68.     there appears to be no difference between them, I only define one
  69.     way to set it.
  70. */
  71.  
  72. #define AUDIO_INIT_BITS_IDLE        0x00
  73. #define AUDIO_INIT_BITS_ACTIVE        0x01
  74. #define AUDIO_INIT_BITS_NOMAP        0x20
  75.  
  76. #define AUDIO_INIT_BITS_INT_ENABLED    0x00
  77. #define AUDIO_INIT_BITS_INT_DISABLED    0x04
  78.  
  79. #define AUDIO_INIT_BITS_CLOCK_DIVIDE_2    0x00
  80. #define AUDIO_INIT_BITS_CLOCK_DIVIDE_1    0x08
  81. #define AUDIO_INIT_BITS_CLOCK_DIVIDE_4    0x10
  82. #define AUDIO_INIT_BITS_CLOCK_DIVIDE_3    0x20
  83.  
  84. #define AUDIO_INIT_BITS_RECEIVE_ABORT    0x40
  85. #define AUDIO_INIT_BITS_TRANSMIT_ABORT    0x80
  86.  
  87. /*    The MUX (Multiplexor) connects inputs and outputs.  The MUX has
  88.     three registers.  Each register can specify two ports in the
  89.     high and low order nibbles.
  90.  
  91.     Here is an example.  To connect ports B1 and Ba, you
  92.     write the following word to a MUX register:
  93.         AUDIO_MUX_PORT_B1 | (AUDIO_MUX_PORT_BA << 4)
  94.     Connections are bidirectional, so it doesn't matter which port
  95.     is which nibble.
  96. */
  97.  
  98. #define AUDIO_MUX_PORT_NONE        0x00
  99. #define AUDIO_MUX_PORT_B1        0x01    /* line interface unit */
  100. #define AUDIO_MUX_PORT_B2        0x02    /* line interface unit */
  101. #define AUDIO_MUX_PORT_BA        0x03    /* main audio processor */
  102. #define AUDIO_MUX_PORT_BB        0x04    /* microprocessor interface */
  103. #define AUDIO_MUX_PORT_BC        0x05    /* microprocessor interface */
  104. #define AUDIO_MUX_PORT_BD        0x06    /* sp channel 1 */
  105. #define AUDIO_MUX_PORT_BE        0x07    /* sp channel 2 */
  106. #define AUDIO_MUX_PORT_BF        0x08    /* sp channel 3 */
  107.  
  108. #define AUDIO_MUX_MCR4_BITS_INT_ENABLE    0x08
  109. #define AUDIO_MUX_MCR4_BITS_INT_DISABLE    0x00
  110. #define AUDIO_MUX_MCR4_BITS_REVERSE_BB    0x10
  111. #define AUDIO_MUX_MCR4_BITS_REVERSE_BC    0x20
  112.  
  113. /*    These are the bit assignments for the mode registers MMR1 and MMR2.
  114. */
  115.  
  116. #define AUDIO_MMR1_BITS_A_LAW        0x01
  117. #define AUDIO_MMR1_BITS_u_LAW        0x00
  118. #define AUDIO_MMR1_BITS_LOAD_GX        0x02
  119. #define AUDIO_MMR1_BITS_LOAD_GR        0x04
  120. #define AUDIO_MMR1_BITS_LOAD_GER    0x08
  121. #define AUDIO_MMR1_BITS_LOAD_X        0x10
  122. #define AUDIO_MMR1_BITS_LOAD_R        0x20
  123. #define AUDIO_MMR1_BITS_LOAD_STG    0x40
  124. #define AUDIO_MMR1_BITS_LOAD_DLB    0x80
  125.  
  126. #define AUDIO_MMR2_BITS_AINA        0x00
  127. #define AUDIO_MMR2_BITS_AINB        0x01
  128. #define AUDIO_MMR2_BITS_EAR        0x00
  129. #define AUDIO_MMR2_BITS_LS        0x02
  130. #define AUDIO_MMR2_BITS_DTMF        0x04
  131. #define AUDIO_MMR2_BITS_TONE        0x08
  132. #define AUDIO_MMR2_BITS_RINGER        0x10
  133. #define AUDIO_MMR2_BITS_HIGH_PASS    0x20
  134. #define AUDIO_MMR2_BITS_AUTOZERO    0x40
  135.  
  136. /*    These are the registers for the chip.
  137.  
  138.     These names are not very descriptive, but they match the names
  139.     chosen by AMD.
  140. */
  141.  
  142. struct    audio_chip {
  143.     char    cr;
  144.     char    dr;
  145.     char    dsr1;
  146.     char    der;
  147.     char    dctb;
  148.     char    bbtb;
  149.     char    bctb;
  150.     char    dsr2;
  151. };
  152.  
  153. #define ir    cr
  154. #define    bbrb    bbtb
  155. #define bcrb    bctb
  156.